﻿var Index = {}
Index.__namespace = true;

Index.RssItemGrid_onChange = function (e) {
    /// <summary>When an item is selected in the grid, display the forum post details.</summary>

    var selected = $.map(this.select(), function (item) {
        return $(item).text();
    });
    var rssItem = $('#rssItemGrid').data('kendoGrid').dataSource._data[this.select().index()];
    Index.displayItem(rssItem);
}

Index.displayItem = function (rssItem) {
    /// <summary>Display the selected RSS Item.</summary>

    if (rssItem != undefined) {
        $('#url').attr('href', rssItem.Link).text(rssItem.Link).closest('div').css('visibility', 'visible');
        $('#description').html(rssItem.Description);
    } else {
        $('#url').closest('div').css('visibility', 'hidden');
        $('#description').html('&nbsp;');
    }
}